//
//  GameoverViewController.m
//  Palabris
//
//  Created by 822588 on 28.11.12.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#import "GameoverViewController.h"

#import "GameViewController.h"
#import "MainscreenViewController.h"
#import "HighscoreViewController.h"



@implementation GameoverViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)dealloc
{
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}


/*  Pop to GameViewController
 */
-(IBAction)goGame:(id)sender{
    
    
    [self.navigationController popViewControllerAnimated:YES];

}


/*  PopToRoot to MainscreenViewController
 */
-(IBAction)goMainscreen:(id)sender{
    
    
    // Wir wollen zum Mainscreen (das vorletzte ViewController im Stack) und nicht zu Root
    UIViewController *secondViewController = [self.navigationController.viewControllers objectAtIndex:1];
    [self.navigationController popToViewController:secondViewController animated:YES];
    
}


/*  Push to HighscoreViewController
 */
-(IBAction)goHighscore:(id)sender{
    
    // Als erstes erstellt man ein Object vom ViewController (Page) zu der man hin will
    HighscoreViewController *view = [[HighscoreViewController alloc] initWithNibName:@"HighscoreViewController" bundle:nil];
    
    // Hier bestimmt ich welche Animation der Übergang bekommt
    view.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    
    // Hier ruft man von der NavigationController (der oberste Vater-Controller) die Push Methode, die dich zu anderen View bringt.
    [self.navigationController pushViewController:view animated:YES];
    

    [view release];
}

@end
